Fix to previous changeset: CLTS must be unconditional in
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 14 Feb 2006 23:37:15 +0000 (00:37 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 14 Feb 2006 23:37:15 +0000 (00:37 +0100)
setup_fpu(), as the flag can be set in CR0 even if the VCPU
has already dirtied the FPU (this happens if a paravirtualised
guest has set CR0.TS).

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/include/asm-x86/i387.h

index fa9ba43e90e92091befee8b2a7bc3bdf294412b2..a324af013ff5405a1a8547f16a465ffdfde4f489 100644 (file)
 #include <asm/processor.h>
 
 extern void init_fpu(void);
-extern void save_init_fpu(struct vcpu *tsk);
-extern void restore_fpu(struct vcpu *tsk);
+extern void save_init_fpu(struct vcpu *v);
+extern void restore_fpu(struct vcpu *v);
 
-#define unlazy_fpu(_tsk) do { \
-    if ( test_bit(_VCPUF_fpu_dirtied, &(_tsk)->vcpu_flags) ) \
-        save_init_fpu(_tsk); \
+#define unlazy_fpu(v) do {                                      \
+    if ( test_bit(_VCPUF_fpu_dirtied, &(v)->vcpu_flags) )       \
+        save_init_fpu(v);                                       \
 } while ( 0 )
 
-#define load_mxcsr( val ) do { \
-    unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf); \
-    __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) ); \
+#define load_mxcsr(val) do {                                    \
+    unsigned long __mxcsr = ((unsigned long)(val) & 0xffbf);    \
+    __asm__ __volatile__ ( "ldmxcsr %0" : : "m" (__mxcsr) );    \
 } while ( 0 )
 
-/* Make domain the FPU owner */
 static inline void setup_fpu(struct vcpu *v)
 {
+    /* Avoid recursion. */
+    clts();
+
     if ( !test_and_set_bit(_VCPUF_fpu_dirtied, &v->vcpu_flags) )
     {
-        clts();
         if ( test_bit(_VCPUF_fpu_initialised, &v->vcpu_flags) )
             restore_fpu(v);
         else